package com.hgy.plugin.security;

import com.hgy.common.utils.ReflectionUtil;
import com.hgy.framework.helper.ConfigHelper;

/**
 * 从配置文件中获取对应的属性
 * 
 * @author alone
 *
 */
public final class SecurityConfig {
	
	public static String getRealms(){
		return ConfigHelper.getString(SecurityConstant.REALMS);
	}
	
	public static String getJdbcAuthcQuery(){
		return ConfigHelper.getString(SecurityConstant.JDBC_AUTHC_QUERY);
	}
	
	public static String getJdbcRolesQuery(){
		return ConfigHelper.getString(SecurityConstant.JDBC_ROLES_QUERY);
	}
	
	public static String getJdbcPermissionQuery(){
		return ConfigHelper.getString(SecurityConstant.JDBC_PERMISSIONS_QUERY);
	}
	
	public static SmartSecurity getSmartSecurtiy(){
		String className = ConfigHelper.getString(SecurityConstant.SMART_SECURITY);
		return (SmartSecurity) ReflectionUtil.newInstance(className);
	}
	
	public static boolean isCacheable(){
		return ConfigHelper.getBoolean(SecurityConstant.CACHE);
	}
	
}
